import React, {useContext} from 'react';
import globalContext from "../context";
function A(props) {
    // console.log(useContext(globalContext));// {userName: 'zhangsan', age: 12}
    const {userName,age,setUserName} = useContext(globalContext);
    return (
        <div>
            <h3>A</h3>
            <button onClick={setUserName.bind(null,"yanqi")}>更改userName</button>
            <p>userName:{userName}</p>
            <p>age:{age}</p>
        </div>
    );
}

export default A;